# MCP23017 GPA口配置/输入/输出相关寄存器地址
MCP23017_IODIRA = 0x00
MCP23017_IPOLA  = 0x02
MCP23017_GPINTENA = 0x04
MCP23017_DEFVALA = 0x06
MCP23017_INTCONA = 0x08
MCP23017_IOCONA = 0x0A
MCP23017_GPPUA = 0x0C
MCP23017_INTFA = 0x0E
MCP23017_INTCAPA = 0x10
MCP23017_GPIOA = 0x12
MCP23017_OLATA = 0x14
# MCP23017 GPB口配置/输入/输出相关寄存器地址
MCP23017_IODIRB = 0x01
MCP23017_IPOLB = 0x03
MCP23017_GPINTENB = 0x05
MCP23017_DEFVALB = 0x07
MCP23017_INTCONB = 0x09
MCP23017_IOCONB = 0x0B
MCP23017_GPPUB = 0x0D
MCP23017_INTFB = 0x0F
MCP23017_INTCAPB = 0x11
MCP23017_GPIOB = 0x13
MCP23017_OLATB = 0x15
# LCD1602 数据读写掩码
DATA_MASK = 0x1E
WRITE_CMD_MASK = 0x20
WRITE_DATA_MASK = 0xA0
WRITE_EN = 0xDF
READ_MASK = 0x1F
# RGB 三色灯掩码
LIGHT_G = 0x01
LIGHT_B = 0x80
LIGHT_R = 0x40
# LCD1602 背光掩码
LIGHT_K = 0x20
# LCD1602 数据倒位表
DRMAP = [0x0, 0x8, 0x4, 0xC, 0x2, 0xA, 0x6, 0xE, 0x1, 0x9, 0x5, 0xD, 0x3, 0xB, 0x7, 0xF]
# I2C 设备号
MCP23017_ID = 1
# I2C 设备地址
MCP23017_ADDRESS = 0x20